from django.db import models


# Create your models here.
# 路径表
class PathModel(models.Model):
    title = models.CharField('路径名称', max_length=50)
    img = models.ImageField('路径logo', upload_to='image')
    desc = models.CharField('路径介绍', max_length=240)
    def __str__(self):
        return self.title
    class Meta:
        db_table = 'tb_path'



# 阶段表
class Phases(models.Model):
    title = models.CharField('阶段名称', max_length=72)
    numb = models.CharField('阶段编号', max_length=24)
    #路径表和阶段表应该是manymanyfiled
    ppath = models.ForeignKey(PathModel,on_delete=models.SET_NULL, null=True)

    class Meta:
        db_table = 'tb_phases'
    def __str__(self):
        return self.title
